<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for ./src/ocLazyLoad.loaders.common.js</title>
    <meta charset="utf-8">

    <link rel="stylesheet" href="../prettify.css">

    <link rel="stylesheet" href="../base.css">
    <style type='text/css'>
        div.coverage-summary .sorter {
            background-image: url(../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class="header medium">
    <h1>Code coverage report for <span class="entity">./src/ocLazyLoad.loaders.common.js</span></h1>
    <h2>
        
        Statements: <span class="metric">67.69% <small>(44 / 65)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">53.06% <small>(26 / 49)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">87.5% <small>(7 / 8)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">68.75% <small>(44 / 64)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
    </h2>
    <div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">./src\</a> &#187; ocLazyLoad.loaders.common.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">26</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-yes">10</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-yes">11</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">25</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
&nbsp;
(function (angular) {
    "use strict";
&nbsp;
    angular.module("oc.lazyLoad").config(function ($provide) {
        $provide.decorator("$ocLazyLoad", function ($delegate, $q, $window, $interval) {
            var uaCssChecked = false,
                useCssLoadPatch = false,
                anchor = $window.document.getElementsByTagName("head")[0] || <span class="branch-1 cbranch-no" title="branch not covered" >$window.document.getElementsByTagName("body")[0];</span>
&nbsp;
            /**
             * Load a js/css file
             * @param type
             * @param path
             * @param params
             * @returns promise
             */
            $delegate.buildElement = function buildElement(type, path, params) {
                var deferred = $q.defer(),
                    el,
                    loaded,
                    filesCache = $delegate._getFilesCache(),
                    cacheBuster = function cacheBuster(url) {
                    var dc = new Date().getTime();
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (url.indexOf("?") &gt;= 0) {
<span class="cstat-no" title="statement not covered" >                        if (url.substring(0, url.length - 1) === "&amp;") {</span>
<span class="cstat-no" title="statement not covered" >                            return "" + url + "_dc=" + dc;</span>
                        }
<span class="cstat-no" title="statement not covered" >                        return "" + url + "&amp;_dc=" + dc;</span>
                    } else {
                        return "" + url + "?_dc=" + dc;
                    }
                };
&nbsp;
                // Store the promise early so the file load can be detected by other parallel lazy loads
                // (ie: multiple routes on one page) a 'true' value isn't sufficient
                // as it causes false positive load results.
                <span class="missing-if-branch" title="else path not taken" >E</span>if (angular.isUndefined(filesCache.get(path))) {
                    filesCache.put(path, deferred.promise);
                }
&nbsp;
                // Switch in case more content types are added later
                switch (type) {
                    case "css":
                        el = $window.document.createElement("link");
                        el.type = "text/css";
                        el.rel = "stylesheet";
                        el.href = params.cache === false ? <span class="branch-0 cbranch-no" title="branch not covered" >cacheBuster(path) </span>: path;
                        break;
                    case "js":
                        el = $window.document.createElement("script");
                        el.src = params.cache === false ? cacheBuster(path) : path;
                        break;
<span class="branch-2 cbranch-no" title="branch not covered" >                    default:</span>
<span class="cstat-no" title="statement not covered" >                        deferred.reject(new Error("Requested type \"" + type + "\" is not known. Could not inject \"" + path + "\""));</span>
<span class="cstat-no" title="statement not covered" >                        break;</span>
                }
                el.onload = el.onreadystatechange = function (e) {
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (el.readyState &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >!/^c|loade/.test(el.readyState) </span>|| loaded) <span class="cstat-no" title="statement not covered" >return;</span>
                    el.onload = el.onreadystatechange = null;
                    loaded = 1;
                    $delegate._broadcast("ocLazyLoad.fileLoaded", path);
                    deferred.resolve();
                };
                el.onerror = function () {
                    deferred.reject(new Error("Unable to load " + path));
                };
                el.async = params.serie ? <span class="branch-0 cbranch-no" title="branch not covered" >0 </span>: 1;
&nbsp;
                var insertBeforeElem = anchor.lastChild;
                if (params.insertBefore) {
                    var element = angular.element(angular.isDefined(window.jQuery) ? <span class="branch-0 cbranch-no" title="branch not covered" >params.insertBefore </span>: document.querySelector(params.insertBefore));
                    <span class="missing-if-branch" title="else path not taken" >E</span>if (element &amp;&amp; element.length &gt; 0) {
                        insertBeforeElem = element[0];
                    }
                }
                anchor.insertBefore(el, insertBeforeElem);
&nbsp;
                /*
                 The event load or readystatechange doesn't fire in:
                 - iOS &lt; 6       (default mobile browser)
                 - Android &lt; 4.4 (default mobile browser)
                 - Safari &lt; 6    (desktop browser)
                 */
                if (type == "css") {
                    <span class="missing-if-branch" title="else path not taken" >E</span>if (!uaCssChecked) {
                        var ua = $window.navigator.userAgent.toLowerCase();
&nbsp;
                        // iOS &lt; 6
                        <span class="missing-if-branch" title="if path not taken" >I</span>if (/iP(hone|od|ad)/.test($window.navigator.platform)) {
<span class="cstat-no" title="statement not covered" >                            var v = $window.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);</span>
<span class="cstat-no" title="statement not covered" >                            var iOSVersion = parseFloat([parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)].join("."));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = iOSVersion &lt; 6;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("android") &gt; -1) {
                            // Android &lt; 4.4
<span class="cstat-no" title="statement not covered" >                            var androidVersion = parseFloat(ua.slice(ua.indexOf("android") + 8));</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = androidVersion &lt; 4.4;</span>
                        } else <span class="missing-if-branch" title="if path not taken" >I</span>if (ua.indexOf("safari") &gt; -1 &amp;&amp; <span class="branch-1 cbranch-no" title="branch not covered" >ua.indexOf("chrome") == -1 </span>&amp;&amp; <span class="branch-2 cbranch-no" title="branch not covered" >ua.indexOf("phantomjs") == -1)</span> {
<span class="cstat-no" title="statement not covered" >                            var safariVersion = parseFloat(ua.match(/version\/([\.\d]+)/i)[1]);</span>
<span class="cstat-no" title="statement not covered" >                            useCssLoadPatch = safariVersion &lt; 6;</span>
                        }
                    }
&nbsp;
                    <span class="missing-if-branch" title="if path not taken" >I</span>if (useCssLoadPatch) {
<span class="cstat-no" title="statement not covered" >                        var tries = 1000; </span>// * 20 = 20000 miliseconds
<span class="cstat-no" title="statement not covered" >                        var interval = $interval(<span class="fstat-no" title="function not covered" >function () {</span></span>
<span class="cstat-no" title="statement not covered" >                            try {</span>
<span class="cstat-no" title="statement not covered" >                                el.sheet.cssRules;</span>
<span class="cstat-no" title="statement not covered" >                                $interval.cancel(interval);</span>
<span class="cstat-no" title="statement not covered" >                                el.onload();</span>
                            } catch (e) {
<span class="cstat-no" title="statement not covered" >                                if (--tries &lt;= 0) {</span>
<span class="cstat-no" title="statement not covered" >                                    el.onerror();</span>
                                }
                            }
                        }, 20);
                    }
                }
&nbsp;
                return deferred.promise;
            };
&nbsp;
            return $delegate;
        });
    });
})(angular);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkM6L3dhbXAvd3d3L29jTGF6eUxvYWQvc3JjL29jTGF6eUxvYWQubG9hZGVycy5jb21tb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxDQUFDLFVBQUEsT0FBTyxFQUFJO0FBQ1IsZ0JBQVksQ0FBQzs7QUFFYixXQUFPLENBQUMsTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxVQUFBLFFBQVEsRUFBSTtBQUM3QyxnQkFBUSxDQUFDLFNBQVMsQ0FBQyxhQUFhLEVBQUUsVUFBUyxTQUFTLEVBQUUsRUFBRSxFQUFFLE9BQU8sRUFBRSxTQUFTLEVBQUU7QUFDMUUsZ0JBQUksWUFBWSxHQUFHLEtBQUs7Z0JBQ3BCLGV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LENBQUMsQ0FBQyIsImZpbGUiOiJDOi93YW1wL3d3dy9vY0xhenlMb2FkL3NyYy9vY0xhenlMb2FkLmxvYWRlcnMuY29tbW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiKGFuZ3VsYXIgPT4ge1xuICAgICd1c2Ugc3RyaWN0JztcblxuICAgIGFuZ3VsYXIubW9kdWxlKCdvYy5sYXp5TG9hZCcpLmNvbmZpZygkcHJvdmlkZSA9PiB7XG4gICAgICAgICRwcm92aWRlLmRlY29yYXRvcignJG9jTGF6eUxvYWQnLCBmdW5jdGlvbigkZGVsZWdhdGUsICRxLCAkd2luZG93LCAkaW50ZXJ2YWwpIHtcbiAgICAgICAgICAgIHZhciB1YUNzc0NoZWNrZWQgPSBmYWxzZSxcbiAgICAgICAgICAgICAgICB1c2VDc3NMb2FkUGF0Y2ggPSBmYWxzZSxcbiAgICAgICAgICAgICAgICBhbmNob3IgPSAkd2luZG93LmRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCdoZWFkJylbMF0gfHwgJHdpbmRvdy5kb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnYm9keScpWzBdO1xuXG4gICAgICAgICAgICAvKipcbiAgICAgICAgICAgICAqIExvYWQgYSBqcy9jc3MgZmlsZVxuICAgICAgICAgICAgICogQHBhcmFtIHR5cGVcbiAgICAgICAgICAgICAqIEBwYXJhbSBwYXRoXG4gICAgICAgICAgICAgKiBAcGFyYW0gcGFyYW1zXG4gICAgICAgICAgICAgKiBAcmV0dXJucyBwcm9taXNlXG4gICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICRkZWxlZ2F0ZS5idWlsZEVsZW1lbnQgPSBmdW5jdGlvbiBidWlsZEVsZW1lbnQodHlwZSwgcGF0aCwgcGFyYW1zKSB7XG4gICAgICAgICAgICAgICAgdmFyIGRlZmVycmVkID0gJHEuZGVmZXIoKSxcbiAgICAgICAgICAgICAgICAgICAgZWwsXG4gICAgICAgICAgICAgICAgICAgIGxvYWRlZCxcbiAgICAgICAgICAgICAgICAgICAgZmlsZXNDYWNoZSA9ICRkZWxlZ2F0ZS5fZ2V0RmlsZXNDYWNoZSgpLFxuICAgICAgICAgICAgICAgICAgICBjYWNoZUJ1c3RlciA9IGZ1bmN0aW9uIGNhY2hlQnVzdGVyKHVybCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRjID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZih1cmwuaW5kZXhPZignPycpID49IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZih1cmwuc3Vic3RyaW5nKDAsIHVybC5sZW5ndGggLSAxKSA9PT0gJyYnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBgJHsgdXJsIH1fZGM9JHsgZGMgfWA7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBgJHsgdXJsIH0mX2RjPSR7IGRjIH1gO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCR7IHVybCB9P19kYz0keyBkYyB9YDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgICAgIC8vIFN0b3JlIHRoZSBwcm9taXNlIGVhcmx5IHNvIHRoZSBmaWxlIGxvYWQgY2FuIGJlIGRldGVjdGVkIGJ5IG90aGVyIHBhcmFsbGVsIGxhenkgbG9hZHNcbiAgICAgICAgICAgICAgICAvLyAoaWU6IG11bHRpcGxlIHJvdXRlcyBvbiBvbmUgcGFnZSkgYSAndHJ1ZScgdmFsdWUgaXNuJ3Qgc3VmZmljaWVudFxuICAgICAgICAgICAgICAgIC8vIGFzIGl0IGNhdXNlcyBmYWxzZSBwb3NpdGl2ZSBsb2FkIHJlc3VsdHMuXG4gICAgICAgICAgICAgICAgaWYoYW5ndWxhci5pc1VuZGVmaW5lZChmaWxlc0NhY2hlLmdldChwYXRoKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgZmlsZXNDYWNoZS5wdXQocGF0aCwgZGVmZXJyZWQucHJvbWlzZSk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gU3dpdGNoIGluIGNhc2UgbW9yZSBjb250ZW50IHR5cGVzIGFyZSBhZGRlZCBsYXRlclxuICAgICAgICAgICAgICAgIHN3aXRjaCh0eXBlKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Nzcyc6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbCA9ICR3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnbGluaycpO1xuICAgICAgICAgICAgICAgICAgICAgICAgZWwudHlwZSA9ICd0ZXh0L2Nzcyc7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5yZWwgPSAnc3R5bGVzaGVldCc7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5ocmVmID0gcGFyYW1zLmNhY2hlID09PSBmYWxzZSA/IGNhY2hlQnVzdGVyKHBhdGgpIDogcGF0aDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdqcyc6XG4gICAgICAgICAgICAgICAgICAgICAgICBlbCA9ICR3aW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7XG4gICAgICAgICAgICAgICAgICAgICAgICBlbC5zcmMgPSBwYXJhbXMuY2FjaGUgPT09IGZhbHNlID8gY2FjaGVCdXN0ZXIocGF0aCkgOiBwYXRoO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoYFJlcXVlc3RlZCB0eXBlIFwiJHsgdHlwZSB9XCIgaXMgbm90IGtub3duLiBDb3VsZCBub3QgaW5qZWN0IFwiJHsgcGF0aCB9XCJgKSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZWwub25sb2FkID0gZWxbJ29ucmVhZHlzdGF0ZWNoYW5nZSddID0gZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICAgICAgICBpZigoZWxbJ3JlYWR5U3RhdGUnXSAmJiAhL15jfGxvYWRlLy50ZXN0KGVsWydyZWFkeVN0YXRlJ10pKSB8fCBsb2FkZWQpIHJldHVybjtcbiAgICAgICAgICAgICAgICAgICAgZWwub25sb2FkID0gZWxbJ29ucmVhZHlzdGF0ZWNoYW5nZSddID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgbG9hZGVkID0gMTtcbiAgICAgICAgICAgICAgICAgICAgJGRlbGVnYXRlLl9icm9hZGNhc3QoJ29jTGF6eUxvYWQuZmlsZUxvYWRlZCcsIHBhdGgpO1xuICAgICAgICAgICAgICAgICAgICBkZWZlcnJlZC5yZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgICAgICBlbC5vbmVycm9yID0gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgIGRlZmVycmVkLnJlamVjdChuZXcgRXJyb3IoYFVuYWJsZSB0byBsb2FkICR7IHBhdGggfWApKTtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgIGVsLmFzeW5jID0gcGFyYW1zLnNlcmllID8gMCA6IDE7XG5cbiAgICAgICAgICAgICAgICB2YXIgaW5zZXJ0QmVmb3JlRWxlbSA9IGFuY2hvci5sYXN0Q2hpbGQ7XG4gICAgICAgICAgICAgICAgaWYocGFyYW1zLmluc2VydEJlZm9yZSkge1xuICAgICAgICAgICAgICAgICAgICB2YXIgZWxlbWVudCA9IGFuZ3VsYXIuZWxlbWVudChhbmd1bGFyLmlzRGVmaW5lZCh3aW5kb3cualF1ZXJ5KSA/IHBhcmFtcy5pbnNlcnRCZWZvcmUgOiBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHBhcmFtcy5pbnNlcnRCZWZvcmUpKTtcbiAgICAgICAgICAgICAgICAgICAgaWYoZWxlbWVudCAmJiBlbGVtZW50Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGluc2VydEJlZm9yZUVsZW0gPSBlbGVtZW50WzBdO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGFuY2hvci5pbnNlcnRCZWZvcmUoZWwsIGluc2VydEJlZm9yZUVsZW0pO1xuXG4gICAgICAgICAgICAgICAgLypcbiAgICAgICAgICAgICAgICAgVGhlIGV2ZW50IGxvYWQgb3IgcmVhZHlzdGF0ZWNoYW5nZSBkb2Vzbid0IGZpcmUgaW46XG4gICAgICAgICAgICAgICAgIC0gaU9TIDwgNiAgICAgICAoZGVmYXVsdCBtb2JpbGUgYnJvd3NlcilcbiAgICAgICAgICAgICAgICAgLSBBbmRyb2lkIDwgNC40IChkZWZhdWx0IG1vYmlsZSBicm93c2VyKVxuICAgICAgICAgICAgICAgICAtIFNhZmFyaSA8IDYgICAgKGRlc2t0b3AgYnJvd3NlcilcbiAgICAgICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICAgICBpZih0eXBlID09ICdjc3MnKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmKCF1YUNzc0NoZWNrZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB1YSA9ICR3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBpT1MgPCA2XG4gICAgICAgICAgICAgICAgICAgICAgICBpZigvaVAoaG9uZXxvZHxhZCkvLnRlc3QoJHdpbmRvdy5uYXZpZ2F0b3IucGxhdGZvcm0pKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHYgPSAoJHdpbmRvdy5uYXZpZ2F0b3IuYXBwVmVyc2lvbikubWF0Y2goL09TIChcXGQrKV8oXFxkKylfPyhcXGQrKT8vKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaU9TVmVyc2lvbiA9IHBhcnNlRmxvYXQoW3BhcnNlSW50KHZbMV0sIDEwKSwgcGFyc2VJbnQodlsyXSwgMTApLCBwYXJzZUludCh2WzNdIHx8IDAsIDEwKV0uam9pbignLicpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VDc3NMb2FkUGF0Y2ggPSBpT1NWZXJzaW9uIDwgNjtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZih1YS5pbmRleE9mKFwiYW5kcm9pZFwiKSA+IC0xKSB7IC8vIEFuZHJvaWQgPCA0LjRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYW5kcm9pZFZlcnNpb24gPSBwYXJzZUZsb2F0KHVhLnNsaWNlKHVhLmluZGV4T2YoXCJhbmRyb2lkXCIpICsgOCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUNzc0xvYWRQYXRjaCA9IGFuZHJvaWRWZXJzaW9uIDwgNC40O1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmKHVhLmluZGV4T2YoJ3NhZmFyaScpID4gLTEgJiYgdWEuaW5kZXhPZignY2hyb21lJykgPT0gLTEgJiYgdWEuaW5kZXhPZigncGhhbnRvbWpzJykgPT0gLTEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc2FmYXJpVmVyc2lvbiA9IHBhcnNlRmxvYXQodWEubWF0Y2goL3ZlcnNpb25cXC8oW1xcLlxcZF0rKS9pKVsxXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlQ3NzTG9hZFBhdGNoID0gc2FmYXJpVmVyc2lvbiA8IDY7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZih1c2VDc3NMb2FkUGF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0cmllcyA9IDEwMDA7IC8vICogMjAgPSAyMDAwMCBtaWxpc2Vjb25kc1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGludGVydmFsID0gJGludGVydmFsKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbC5zaGVldC5jc3NSdWxlcztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGludGVydmFsLmNhbmNlbChpbnRlcnZhbCk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsLm9ubG9hZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goZSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZigtLXRyaWVzIDw9IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsLm9uZXJyb3IoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIDIwKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZC5wcm9taXNlO1xuICAgICAgICAgICAgfTtcblxuICAgICAgICAgICAgcmV0dXJuICRkZWxlZ2F0ZTtcbiAgICAgICAgfSlcbiAgICB9KTtcblxufSkoYW5ndWxhcik7XG4iXX0=</pre></td></tr>
</table></pre>

</div>
<div class="footer">
    <div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Apr 16 2015 00:02:59 GMT+0200 (Paris, Madrid (heure d’été))</div>
</div>

<script src="../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>

<script src="../sorter.js"></script>
</body>
</html>
